#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickView>
#include <QQmlEngine>
#include <QQmlContext >
#include "builder.h"
#include "product.h"
#include "director.h"

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    ConcreteBuilder* b = new ConcreteBuilder();
    Director* d = new Director(b);

    d->Construct();

    Product* p = b->GetProduct();


    QQuickView view;
    view.engine()->rootContext()->setContextProperty("Product", p);
    view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
    view.setTitle("Builder模式演示demo");
    view.show();

//    return 0;
    return app.exec();
}
